package kr.co.ljw.refactoring;

/**
 * movie
 * 
 * @author 오스템임플란트 jw
 * @since 2013. 1. 2.
 * @version 1.0
 * @see
 * 
 * <pre>
 * << 개정이력(Modification Information) >>
 *   
 *	  수정일  		수정자				수정내용		
 *	----------		------		------------------------
 *	2013. 1. 2.    jw				최초 생성
 *
 * </pre>
 */
public class Movie {
	public static final int CHILDREN = 2;
	public static final int REGULAR = 0;
	public static final int NEW_RELEASE = 1;
	
	private String	_title;
	private Price		_price;
	
	public Movie(String title, int priceCode){
		_title = title;
		setPriceCode(priceCode);
	}
	
	public String getTitle() {
		return _title;
	}
	public int getPriceCode() {
		return _price.getPriceCode();
	}
	public void setPriceCode(int arg) {
		switch(arg){
			case REGULAR:
				_price = new RegularPrice();
				break;
			case CHILDREN :
				_price = new ChildrenPrice();
				break;
			case NEW_RELEASE :
				_price = new NewReleasePrice();
				
			default :
				throw new IllegalArgumentException("Incorrect Price Code");
		}
	}
	
	public double getCharge(int daysRented){
		return _price.getCharge(daysRented);
	}
	
	public int getFrequentRenterPoints(int daysRented){
		return _price.getFrequentRenterPoints(daysRented);
	}
}